package com.zby.model.pojo;

import com.zby.model.vo.CommentVo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.dromara.autotable.annotation.AutoColumn;
import org.dromara.autotable.annotation.AutoTable;
import org.dromara.autotable.annotation.Index;
import org.dromara.autotable.annotation.TableIndex;
import org.dromara.autotable.annotation.mysql.MysqlTypeConstant;

import java.util.List;

/**
 * @TableName comment
 */
@EqualsAndHashCode(callSuper = true)
@Data
@AutoTable(comment = "评论")
@TableIndex(fields = {"articleId", "deleted"})
@Schema(description = "评论")
public class Comment extends BasePojo {
    @Schema(description = "评论内容")
    @AutoColumn(type = MysqlTypeConstant.TEXT, notNull = true, comment = "评论内容")
    private String content;
    @Schema(description = "评论文章id")
    @AutoColumn(notNull = true, comment = "评论文章id")
    private Integer articleId;
    @Schema(description = "评论用户id")
    @Index
    @AutoColumn(comment = "评论用户id")
    private Integer userId;
    @Schema(description = "父评论id")
    @Index
    @AutoColumn(comment = "父评论id")
    private Integer parentId;
    @Schema(description = "子评论")
    private List<CommentVo> children;

}
